package com.markerhub.common.shiro;

import com.markerhub.common.UserType;
import org.apache.shiro.SecurityUtils;
import org.apache.shiro.session.Session;
import org.apache.shiro.subject.Subject;

/**
 * @ClassName: ShiroUtils
 * @Description:
 */
public class ShiroUtils {

    //得到当前登陆的用户信息
    public static Object getUser(){
        Subject subject = SecurityUtils.getSubject();
        Object user = subject.getPrincipal();
        return user;
    }

    //返回Session
    public static Session getSession(){
        return SecurityUtils.getSubject().getSession();
    }

    //返回用户类型
    public static String getLoginTye(){
        return getSession().getAttribute("loginType").toString();
    }
}
